/********************************************************************************************
 * Header defining the APIs for standalone AES
 *********************************************************************************************/

#ifndef __AES_H
#define __AES_H

#include <stdint.h>
#include <stdlib.h>

/**
 * Function to fill a key schedule given an initial key.
 *
 * @param key            Initial Key.
 * @param schedule       Abstract data structure for a key schedule.
 */
void AES128_load_schedule(const uint8_t *key, uint8_t *schedule);

/**
 * Same as AES128_CTR_enc() except a schedule generated by
 * AES128_load_schedule() is passed rather than a key. This is faster
 * if the same schedule is used for multiple encryptions since it does
 * not have to be regenerated from the key.
 */
void AES128_CTR_enc_sch(const uint8_t *plaintext, const size_t plaintext_len,
						const uint8_t *schedule, uint8_t *ciphertext);

/**
 * Function to free a key schedule.
 *
 * @param schedule       Schedule generated with AES128_load_schedule().
 */
void AES128_free_schedule(uint8_t *schedule);

/**
 * Function to fill a key schedule given an initial key.
 *
 * @param key            Initial Key.
 * @param schedule       Abstract data structure for a key schedule.
 */
void AES256_load_schedule(const uint8_t *key, uint8_t *schedule);

/**
 * Same as AES256_CTR_enc() except a schedule generated by
 * AES256_load_schedule() is passed rather than a key. This is faster
 * if the same schedule is used for multiple encryptions since it does
 * not have to be regenerated from the key.
 */
void AES256_CTR_enc_sch(const uint8_t *plaintext, const size_t plaintext_len,
						const uint8_t *schedule, uint8_t *ciphertext);

/**
 * Function to free a key schedule.
 *
 * @param schedule       Schedule generated with AES256_load_schedule().
 */
void AES256_free_schedule(uint8_t *schedule);

#endif

